package cn.suimg.neo4j.redis;


/**
 * Cache Key
 * 存储Redis Key
 */
public class CacheKeys {

    /**
     * SiteMap 缓存
     */
    public static final CacheKeys SITEMAP_CACHE = new CacheKeys("sitemap_cache", 0);

    /**
     * 音乐统计信息缓存
     */
    public static final CacheKeys STATISTICS_MUSIC_CACHE = new CacheKeys("statistics:music_cache",0);

    /**
     * 音乐缓存 -> 歌手
     */
    public static final CacheKeys MUSIC_CACHE_SINGER = new CacheKeys("music_cache:singer:",1);

    /**
     * 音乐缓存 -> 专辑
     */
    public static final CacheKeys MUSIC_CACHE_ALBUM = new CacheKeys("music_cache:album:",1);

    /**
     * 音乐缓存 -> 歌曲
     */
    public static final CacheKeys MUSIC_CACHE_SONG = new CacheKeys("music_cache:song:",1);

    /**
     * 音乐缓存 -> 歌手写真
     */
    public static final CacheKeys MUSIC_CACHE_SINGER_IMAGE = new CacheKeys("music_cache:singer_image:",1);

    /**
     * 音乐缓存 -> 歌手
     */
    public static final CacheKeys MUSIC_CACHE_SINGER_NAME = new CacheKeys("music_cache:singer_name:",1);

    /**
     * 音乐缓存 -> 哈希值的下载链接
     */
    public static final CacheKeys MUSIC_CACHE_HASH_PLAY_URL = new CacheKeys("music_cache:hash_download_info:",1);

    /**
     * 音乐缓存 -> 哈希值的下载链接
     */
    public static final CacheKeys MUSIC_CACHE_HASH_PLAY_URL_WITH_SSL = new CacheKeys("music_cache:hash_download_info_with_ssl:",1);

    /**
     * 音乐缓存 -> 歌曲详细信息
     */
    public static final CacheKeys MUSIC_CACHE_SONG_DETAIL_INFO = new CacheKeys("music_cache:song_detail_info:",1);

    /**
     * Hash映射
     */
    public static final CacheKeys MUSIC_CACHE_HASH_MAPPING = new CacheKeys("music_cache:hash_mapping:",1);

    /**
     * 歌词缓存
     */
    public static final CacheKeys MUSIC_CACHE_LYRIC = new CacheKeys("music_cache:lyric:",1);

    /**
     * 步数信息缓存 -> 用户登录信息
     */
    public static final CacheKeys STEP_CACHE_USER = new CacheKeys("step_cache:user:",2);

    /**
     * 步数信息缓存 -> 会话ID对应的用户
     */
    public static final CacheKeys STEP_CACHE_SESSION_ID_2_USER = new CacheKeys("step_cache:session_id_2_user:",2);

    /**
     * 步数信息缓存 -> 用户ID查询会话ID
     */
    public static final CacheKeys STEP_CACHE_USER_2_SESSION_ID = new CacheKeys("step_cache:user_2_session_id:",2);

    /**
     * 步数信息缓存 -> 登录会话信息
     */
    public static final CacheKeys STEP_CACHE_LOGIN_SESSION = new CacheKeys("step_cache:session:",2);

    /**
     * 会话ID List
     */
    public static final CacheKeys STEP_CACHE_SESSION_LIST = new CacheKeys("step_cache:session_list",2);

    /**
     * 微信授权Token，存储在第15个库当中 (15号库存放配置)
     */
    public static final CacheKeys WECHAT_ACCESS_TOKEN = new CacheKeys("wechat_access_token", 15);

    /**
     * 酷狗登录之后的token
     */
    public static final CacheKeys KUGOU_LOGIN_TOKEN = new CacheKeys("kugou_login_token",15);

    /**
     * JS API 用到的ticket 存储在第15个库当中  (15号库存放配置)
     */
    public static final CacheKeys JS_API_TICKET = new CacheKeys("js_api_ticket", 15);

    /**
     * 调用百度API的时候存储的访问token
     */
    public static final CacheKeys BAIDU_ACCESS_TOKEN = new CacheKeys("baidu_access_token", 15);

    private String key;

    private int db;

    private CacheKeys(String key, int db) {
        this.key = key;
        this.db = db;
    }

    public static CacheKeys keyLink(CacheKeys cacheKeys, Object linkStr) {
        return new CacheKeys(cacheKeys.getKey() + linkStr.toString() , cacheKeys.getDb());
    }

    String getKey() {
        return key;
    }

    int getDb() {
        return db;
    }
}
